<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<style>
  #div1 {
    width: 100px;
    height: 200px;
    background: #CCC;
    display: none;
  }
</style>

<body>

  <script>
    function showHide() {
      let div1 = document.getElementById("div1")
      if (div1.style.display == "block") {
        div1.style.display = "none"
      } else {
        div1.style.display = "block"
      }


    }
  </script>

  <input type="button" value="显示隐藏" onclick="showHide()" />

  <div id="div1">


  </div>

</body>

</html>